< previous page page_583 next page >

Page 583
INI Class
Lets now build a class module that makes using the API calls easier. As you saw in the previous examples, when youre storing or retrieving data from the same section, you have to repeat the INI filename and section name as well as reallocate the buffer space every time. This can be quite a bit of work. Instead, lets wrap up this functionality in a class.
Examples Filename: INI.cls
Properties of the INI Class
Table 29.1 shows you the public properties of this INI class as well as the private variable each property relates to inside of the class.
Table 29.1 Properties of the INI Class.
Public PropertyPrivate VariableDescription
ConfigNamemstrConfigNameThe name of the INI file
SectionNamemstrSectionThe name of the section to retrieve data from or set data to
KeyNamemstrKeyNameThe name of the key to read from or write to
KeyValuemstrKeyValueThe value to write to the INI file

Public Methods of the INI Class
Besides the properties of the INI class, you have methods that allow you to read and write to the INI file. Table 29.2 lists each of the method names and provides a description of each.
Table 29.2 Methods of the INI Class.
Method NameDescription
KeyGetRetrieves information from the INI file and returns it as a string value
KeySaveSaves information back to the INI file

(table continued on next page)

 
< previous page page_583 next page >

If you like this book, buy it!